package com.jmp.autocofiguration;

import lombok.extern.slf4j.Slf4j;
import one.stand.util.RedisUtil;
import org.springframework.boot.CommandLineRunner;

@Slf4j
public class InitApplicationRunner implements CommandLineRunner {
    private RedisUtil redisUtil;
    private JmpProperties jmpProperties;

    public InitApplicationRunner(RedisUtil redisUtil, JmpProperties jmpProperties) {
        this.redisUtil = redisUtil;
        this.jmpProperties = jmpProperties;
        log.info("start init(dev:{})...", jmpProperties.isDev());
    }

    @Override
    public void run(String... args) throws Exception {
        if (jmpProperties.getInit().isRedis()) {
            log.info("redis预热...");
            redisUtil.get("init");
        }
    }
}
